

function deepMerge(target, source) {
    if (typeof target!== 'object' || target === null) {
      return source;
    }
    if (typeof source!== 'object' || source === null) {
      return target;
    }
    for (let key in source) {
      if (source.hasOwnProperty(key)) {
        if (typeof source[key] === 'object' && source[key]!== null &&
            typeof target[key] === 'object' && target[key]!== null) {
          target[key] = deepMerge(target[key], source[key]);
        } else {
          target[key] = source[key];
        }
      }
    }
    return target;
  }
  
  // 示例用法
//   let obj1 = { a: 1, b: { c: 2 ,d:4}, c: [1,2,3] };
//   let obj2 = { b: { d: 3 , c:9}, c:[3,4], e: 4 };
//   let mergedObj = deepMerge(obj1, obj2);
//   console.log(mergedObj);

module.exports = {
    deepMerge
}